<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var btns = [{
      text: '登录',
      width: 92,
      height: 25,
      color: '#fff',
      BG: '#f20',
      marginR: 8,
      textAlign: 'center',
    },
    {
      text: '注册',
      width: 75,
      height: 25,
      color: '#fff',
      BG: '#f20',
      marginR: 8,
      textAlign: 'center',
    },
    {
      text: '开店',
      width: 75,
      height: 25,
      color: '#fff',
      BG: '#f20',
      marginR: 8,
      textAlign: 'center',
    }

    ]
    for (var i = 0; i < btns.length; i++) {
      var div = document.createElement('div');
      var btn = btns[i];
      div.style.float = 'left';
      div.innerText = btn.text;
      div.style.width = btn.width + 'px';
      div.style.height = btn.height + 'px';
      div.style.color = btn.color;
      div.style.backgroundColor = btn.BG;
      div.style.lineHeight = btn.height + 'px';
      div.style.textAlign = btn.textAlign;
      div.style.marginRight = btn.marginR + 'px';
      document.body.appendChild(div);
    }
  </script>
</body>

</html>